<!doctype html>
<html xmlns:th="http://www.thymeleaf.org" class="x-admin-sm">
<head>
	<meta charset="UTF-8">
	<title>[(${projectName})]-登录</title>
	<meta name="renderer" content="webkit|ie-comp|ie-stand">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width,user-scalable=yes, minimum-scale=0.4, initial-scale=0.8,target-densitydpi=low-dpi" />
    <meta http-equiv="Cache-Control" content="no-siteapp" />
	  
    <script type="text/javascript" src="/static/plugins/jquery-3/jquery.min.js"></script>
    
    <link href="/static/plugins/bootstrap-3/css/bootstrap.min.css" rel="stylesheet" type="text/css">
	<script src="/static/plugins/bootstrap-3/js/bootstrap.min.js"></script>
    <link rel="stylesheet" href="/static/assets2/css/font.css">
    <link rel="stylesheet" href="/static/assets2/css/login.css">
	<link rel="stylesheet" href="/static/assets2/css/xadmin.css">
    <script src="/static/plugins/layui/layui.js" charset="utf-8"></script>
    <!--[if lt IE 9]>
      <script src="https://cdn.staticfile.org/html5shiv/r29/html5.min.js"></script>
      <script src="https://cdn.staticfile.org/respond.js/1.4.2/respond.min.js"></script>
    <![endif]-->
</head>
<body class="login-bg">
    
    <div class="login layui-anim layui-anim-up">
        <div class="message">[(${projectName})]-登录</div>
        
	    <div class="panel">
	
	        <div class="panel-body">
	            <form class="form-horizontal" id="id_form_login" method="post" action="/login">
	
	                <div class="form-group">
	                    <div class="col-xs-12">
	                        <input class="form-control input-lg" type="text" required="" placeholder="账号" name="adminloginname" value="">
	                    </div>
	                </div>
	
	                <div class="form-group">
	                    <div class="col-xs-12">
	                        <input class="form-control input-lg" type="password" required="" placeholder="密码" value="" name="adminpassword">
	                    </div>
	                </div>
	                
	                <div class="form-group">
	                    <div class="col-xs-6">
							<input class="form-control input-lg" type="text" placeholder="验证码" name="imgcodevalue" value="" id="id_imgcode_value" />
						</div>
	                    <div class="col-xs-6">
							<label>
								<img type="image" src="/api/outer/img/code" onclick="changeImgcode()" id="id_imgcode_image" />
							</label>
						</div>
					</div>
	
	                <div class="form-group text-center m-t-40">
	                    <div class="col-xs-12">
	                        <button class="btn btn-primary btn-lg w-lg waves-effect waves-light" type="button" id="id_btn_login">登 录</button>
	                    </div>
	                </div>
	            </form>
	        </div>
	
	    </div>
    </div>

    <script>
        $(function  () {
            //监听提交
            $('#id_btn_login').click(function(){
                $.ajax({
                    type: "POST",
                    url: "/login",
                    data: $('#id_form_login').serialize(),
                    success: function (data) {
                        if (data.code == 0) {
                            location.href= '/index';
                        } else {
                        	alert(data.msg);
                        }
                    }
                });
            });
        })
    	
        // 更新图形验证码
    	function changeImgcode() {
    		var imgcodeImage = document.getElementById('id_imgcode_image');
    		imgcodeImage.src = '/api/outer/img/code?abc=' + Math.random();
    		document.getElementById('id_imgcode_value').value = '';
    	}
    </script>
    <!-- 底部结束 -->
</body>
</html>